﻿using System;
using Airborne.ScrumPoker.Model.TeamFoundation;
using Airborne.ScrumPoker.Module.Events;
using Airborne.ScrumPoker.Module.TeamFoundation.Model;
using Airborne.ScrumPoker.Module.TeamFoundation.Views;

namespace Airborne.ScrumPoker.Module.TeamFoundation.Tests.Mocks
{
    public class MockWorkItemView : IWorkItemSelectView
    {
        #region Properties
        public ITeamProject[] Projects { get; set; }
        public ITeamWorkItem[] WorkItems { get; set; }
        public TeamFoundationConfiguration Configuration { get; set; }

        #endregion
        #region IWorkItemSelectView Members

        public void SetProjects(ITeamProject[] projects)
        {
            Projects = projects;
        }

        public void SetWorkItems(ITeamWorkItem[] workItems)
        {
            WorkItems = workItems;
        }

        #endregion

        
			#region WorkItemSelected

        public event EventHandler<ItemSelectedEventArgs<ITeamWorkItem>> WorkItemSelected;

        public void RaiseWorkItemSelected(ITeamWorkItem item)
			{
             ItemSelectedEventArgs<ITeamWorkItem> args = new ItemSelectedEventArgs<ITeamWorkItem>(item);
				OnWorkItemSelected(args);
			}

        protected virtual void OnWorkItemSelected(ItemSelectedEventArgs<ITeamWorkItem> args)
			{
             EventHandler<ItemSelectedEventArgs<ITeamWorkItem>> handler = this.WorkItemSelected;
				if( handler != null)
				{
					handler( this, args);
				}
			}
			
			#endregion

        
			#region ProjectSelected

			public event EventHandler<ItemSelectedEventArgs<ITeamProject>> ProjectSelected;
			
			public void  RaiseProjectSelected( ITeamProject project )
			{
             ItemSelectedEventArgs<ITeamProject> args = new ItemSelectedEventArgs<ITeamProject>(project);
				OnProjectSelected(args);
			}

			protected virtual void OnProjectSelected( ItemSelectedEventArgs<ITeamProject> args )
			{
				EventHandler<ItemSelectedEventArgs<ITeamProject>> handler = this.ProjectSelected;
				if( handler != null)
				{
					handler( this, args);
				}
			}
			
			#endregion

         #region IWorkItemSelectView Members


         public void ForceNextWorkItemSelection(int steps)
         {
             throw new NotImplementedException();
         }

         #endregion
    }
}
